/**
 * chinagoods.com
 * Copyright (c) 2020-2024 All Rights Reserved.
 */
package com.ruoyi.web.controller.bot;
/**
 * @author yangpeng
 * Created by on 2024-03-26 11:23
 */

import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.springframework.context.annotation.Bean;
import org.telegram.telegrambots.bots.DefaultBotOptions;

/**
 * @author Administrator
 * @version V1.0
 * @date 2022/4/9
 */

public class BotConfig {
    // 梯子的IP，我的是本地的
    public static final String proxyHost = "192.9.231.251";
    // 本地监听的端口
    public static final int proxyPort = 8080;


    @Bean
    public DefaultBotOptions defaultBotOptions() {
//        DefaultBotOptions botOptions = new DefaultBotOptions();
//        botOptions.setProxyHost(proxyHost);
//        botOptions.setProxyPort(proxyPort);
//        //ProxyType是个枚举
//        botOptions.setProxyType(DefaultBotOptions.ProxyType.SOCKS5);
//        botOptions.setProxyType(DefaultBotOptions.ProxyType.NO_PROXY);


        RequestConfig requestConfig = RequestConfig.custom()
                .setProxy(new HttpHost(proxyHost, proxyPort,"socks5-@heroku6"))
                .build();

        DefaultBotOptions botOptions = new DefaultBotOptions();
        botOptions.setProxyHost(proxyHost);
        botOptions.setRequestConfig(requestConfig);

      //  StoreBot bot = new StoreBot(botOptions);

        return botOptions;
    }

//    @Bean
//    public DefaultBotSession DefaultBotSession() {
//        DefaultBotSession defaultBotSession = new DefaultBotSession();
//        defaultBotSession.setOptions(defaultBotOptions());
//        return defaultBotSession;
//    }


}

